home *** CD-ROM | disk | FTP | other *** search
- package test.framework;
-
- import java.util.Enumeration;
- import java.util.Vector;
-
- public class TestResult {
- protected Vector fFailures = new Vector(10);
- protected Vector fErrors = new Vector(10);
- protected int fRunTests = 0;
- private boolean fStop = false;
-
- public synchronized void addError(Test test, Throwable t) {
- this.fErrors.addElement(new TestFailure(test, t));
- }
-
- public synchronized void addFailure(Test test, Throwable t) {
- this.fFailures.addElement(new TestFailure(test, t));
- }
-
- public synchronized void startTest(Test test) {
- ++this.fRunTests;
- }
-
- public synchronized void endTest(Test test) {
- }
-
- public synchronized int runTests() {
- return this.fRunTests;
- }
-
- public synchronized int testErrors() {
- return this.fErrors.size();
- }
-
- public synchronized int testFailures() {
- return this.fFailures.size();
- }
-
- public synchronized boolean wasSuccessful() {
- return this.testFailures() == 0 && this.testErrors() == 0;
- }
-
- public synchronized Enumeration failures() {
- return this.fFailures.elements();
- }
-
- public synchronized Enumeration errors() {
- return this.fErrors.elements();
- }
-
- public synchronized void stop() {
- this.fStop = true;
- }
-
- public synchronized boolean shouldStop() {
- return this.fStop;
- }
- }
-